import React, { Component } from 'react'

export default class List extends Component {
  render() {
    return (
      <div>
        <ul>
          {
            this.props.list.map((item)=>{
              return <li key={item.id}>{item.name}
              <button onClick={this.props.del.bind(this,item.id)}>删除</button>
              <button onClick={()=>{
                this.props.edit(item)
              }}>编辑</button>
              </li>
            })
          }
          {/* <li>item</li> */}
        </ul>
      </div>
    )
  }

  componentDidMount(){
   console.log(this.props.list)
  }
}
